#include <iostream>
#include <vector>
using namespace std;


class Solution {
public:
    void duplicateZeros(vector<int>& arr) {
        int size = arr.size();
        for(int i = 0;i<size;i++)
        {
            if(arr[i] == 0)
            {
                auto it = arr.begin();
                arr.insert(it+i,0);
                i+=2;
            }
        }
        arr.resize(size);
    }
};


int main()
{
    vector<int> arr {0,4,1,0,0,8,0,0,3};
    Solution s;
    s.duplicateZeros(arr);
    return 0;
}